package com.zzl.zzloj.judge.codesandbox.impl;

import com.zzl.zzloj.judge.codesandbox.CodeSandbox;
import com.zzl.zzloj.judge.codesandbox.model.ExcuteCodeRequest;
import com.zzl.zzloj.judge.codesandbox.model.ExcuteCodeResponse;
import com.zzl.zzloj.judge.codesandbox.model.JudgeInfo;
import com.zzl.zzloj.model.enums.JudgeInfoMessageEnum;
import com.zzl.zzloj.model.enums.QuestionSubmitStatusEnum;

import java.util.List;

public class ExampleCodeSandbox implements CodeSandbox {
    @Override
    public ExcuteCodeResponse excuteCode(ExcuteCodeRequest excuteCodeRequest) {
        ExcuteCodeResponse excuteCodeResponse = new ExcuteCodeResponse();
        List<String> inputList = excuteCodeRequest.getInputList();
        JudgeInfo judgeInfo = new JudgeInfo();
        judgeInfo.setMessage(JudgeInfoMessageEnum.ACCEPTED.getValue());
        judgeInfo.setTime(1000L);
        judgeInfo.setMemory(1000L);

        excuteCodeResponse.setMessage("测试执行成功");
        excuteCodeResponse.setJudgeInfo(judgeInfo);
        excuteCodeResponse.setOutputList(inputList);
        excuteCodeResponse.setStatus(QuestionSubmitStatusEnum.SUCCESS.getValue());

        return excuteCodeResponse;
    }
}
